module STACK(reset, aluStackPop,chrStackPush,chrStackData,fsmStackClear,
	     stackAluData);

input aluStackPop,chrStackPush,fsmStackClear;
input reset;
//I do not know how to use 'fsmStackClear' this parameter
input [16:0] chrStackData;
output reg [16:0] stackAluData;

reg [16:0] ram [3:0];

always @(aluStackPop or  chrStackPush or reset or fsmStackClear)
         if(reset || fsmStackClear)
                 begin
                    stackAluData<=17'b0;
                end
          else
                case({aluStackPop,chrStackPush})
                        2'b01: begin
                                ram[3]<=ram[2];
                                ram[2]<=ram[1];
										ram[1]<=ram[0];
                                ram[0]<=chrStackData;
                                 end
                        2'b10: begin
                                stackAluData<=ram[0];
                                ram[2]<=ram[3];
                                ram[1]<=ram[2];
                                ram[0]<=ram[1];
                                end
                        default:;
                endcase
endmodule
